Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDL-14896: Make batch_size apply to the first page and TDL-14895: Use the pagination__list_subscriber_interval_quantity config value correctly #64

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

hpatel41
Copy link
Contributor

Description of change

TDL-14896: Make batch_size apply to the first page

  • Added code change to respect batch_size for 1sy page sync.

TDL-14895: Use the pagination__list_subscriber_interval_quantity config value correctly

  • Corrected the spelling of 'pagination__list_subscriber_interval_quantity' to use for syncing.

Manual QA steps

Risks

Rollback steps

  • revert this branch

@@ -38,10 +38,15 @@ class CampaignDataAccessObject(DataAccessObject):
KEY_PROPERTIES = ['id']

def sync_data(self):
batch_size = int(self.config.get('batch_size', 2500))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are using this variable in multiple places, can we create a one base file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@hpatel41 hpatel41 requested a review from dbshah1212 August 27, 2021 09:34
@hpatel41 hpatel41 marked this pull request as ready for review August 27, 2021 09:34
@@ -19,6 +19,7 @@ def __init__(self, config, state, auth_stub, catalog):
self.state = state.copy()
self.catalog = catalog
self.auth_stub = auth_stub
self.batch_size = int(self.config.get('batch_size', 2500))
Copy link

@dbshah1212 dbshah1212 Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use self.batch_size here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, here the batch size is initialized.


# collect information for assertions from sync based on expected values
record_count_sync = sync_record_count.get(stream, 0)
primary_keys_list = [(message.get('data').get(expected_pk) for expected_pk in expected_primary_keys)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this use: tuple([message['data']['expected_pk'] for expected_pk in expected_primary_keys]) as first comprehension here that iterates over the expected_primary_keys, is just making generators.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

return props

def test_run(self):
page_size = 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have records then use at least 2 instead of one to test pagination properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Email has 2 records only. So, we cannot use page size 2.

@@ -7,13 +7,13 @@
LOGGER = singer.get_logger()


def _get_response_items(response):
def _get_response_items(response, name):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments to the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments

@@ -107,6 +107,8 @@ def request(name, selector, auth_stub, search_filter=None, props=None, batch_siz
"""
cursor = selector()
cursor.auth_stub = auth_stub
# set batch size
cursor.options = {"BatchSize": batch_size}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments regarding the changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment

Comment on lines +153 to +160
if isinstance(cursor, FuelSDK.ET_Campaign):
# use 'getMoreResults' for campaigns as it does not use
# batch_size, rather it uses $page and $pageSize and REST Call
response = cursor.getMoreResults()
else:
# Override call to getMoreResults to add a batch_size parameter
# response = cursor.getMoreResults()
response = tap_exacttarget__getMoreResults(cursor, batch_size=batch_size)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the above changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the above change is to support pagination in the tap to run the pagination test.

@hpatel41 hpatel41 requested a review from KrisPersonal October 13, 2021 06:03
…nResetErrors (#71)

* added backoff for certain errors

* resolve pylint

* updated decorator location

* added unittests

* added comment

* added comments
* updated error message when generating auth_stub

* made changes according to the comments

* updated the code acording to the comments

* updated the tap tester image

* updated pylint and astroid to latest version

* updated the code as, on updating tap tester image it was throwing cascading errors

* updated config.yml file

* updated the start date for integration tests as per the params

* removed scenario as new tap-tester version does not support it

* updated start date in the base file test
* added best practices

* resolve pylint

* resolve test failure

* test: updated the test cases

* test: updated some test cases

* updated the code as per comments

* resolve test case failure

* updated the code as per comments

* resolve integration test failure

* resolve tes case failure

* resolve test case failure

* add data extension stream in test cases

* added data extension incremental stream

* test: run bookmark test

* test: run bookmark test

* test: run bookmark test, debug failing test

* test: pylint resolve

* test: run all data extenstion stream test in bookmark test

* test: updated data extension code

* updated the test to run data extension stream

* run all tests

* added sys.exit and updated pylint and astroid to latest versions

* resolve pylint

* updated the files as per comments

* updated the code
…stream does not bookmark correctly (#75)

* make keys automatic

* pylint resolve

* add full replication test case

* added code change for data extension stream

* pylint resolve

* added comment

* added comments

* added comment in base file

* updated discovery test and removed full replication test

* updated the code

* added a comment explaining subscriber and list subscriber syncing

* added comments
* make keys automatic

* pylint resolve

* add full replication test case

* use transformation

* resolve pylint

* added code change for data extension stream

* pylint resolve

* updated test case for data extension

* added comment

* added comments

* added comments and optimized that condition

* added code change for tranformation function in base file

* pylint resolve

* disabled pylint error

* test: removed disable pylint code

* added comment in base file

* updated comment

* updated the comment for skipping streams

* updated discovery test and removed full replication test

* added verification of unique records

* updated start date

* updated the code

* updated the code

* added a comment explaining subscriber and list subscriber syncing

* added comments

* updated comment

* made separate files for schemas

* resolve pylint

* resolve integration test

* corrected typo

* updated the code

* resolved unittest case error
hpatel41 and others added 3 commits October 13, 2021 23:37
* added code change to use start date when state is not passed

* updated code based on comments

* resolve test case failure

* added data extension stream in tests

* add data extension incremental stream

* added future date test

* updated start date test case

* updated future start date test code

* updated the code

* added comment

* added more comments in the code

* resolve unittests failure

* resolve integration test failure
@hpatel41 hpatel41 mentioned this pull request Oct 13, 2021
Copy link
Contributor

@kspeer825 kspeer825 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this PR be closed? It looks like the changes may have been covered elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants